{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 了解算法性能中的偏差和方差概念\n",
    "## 案例：利用水库水位变化预测大坝出水量\n",
    "### 数据集：ex5data1.mat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from scipy.io import loadmat\n",
    "from scipy.optimize import minimize"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['__header__', '__version__', '__globals__', 'X', 'y', 'Xtest', 'ytest', 'Xval', 'yval'])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = loadmat('ex5data1.mat')\n",
    "data.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((12, 1), (12, 1))"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 训练集\n",
    "X_train,y_train = data['X'],data['y']\n",
    "X_train.shape,y_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((21, 1), (21, 1))"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 验证集\n",
    "X_val,y_val = data['Xval'],data['yval']\n",
    "X_val.shape,y_val.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((21, 1), (21, 1))"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 测试集\n",
    "X_test,y_test = data['Xtest'],data['ytest']\n",
    "X_test.shape,y_test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train = np.insert(X_train,0,1,axis=1)\n",
    "X_val = np.insert(X_val,0,1,axis=1)\n",
    "X_test = np.insert(X_test,0,1,axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_data():\n",
    "    fig,ax = plt.subplots()\n",
    "    ax.scatter(X_train[:,1],y_train)\n",
    "    ax.set(xlabel = 'change in water level(x)',\n",
    "          ylabel = 'water flowing out og the dam(y)')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAHxRJREFUeJzt3Xt8XWWd7/HPl1ogcjFgC7aFGlQsIijVgI4VXoA6FUSpiihHkYNo5YwgIvZI1TMyjo546oCIl7Fyd0BEKOUiUqCABUEkoYWCpYMgOKTVFiRcNEJbfvPHetJuQrKzkuy1dnb29/167Vf2uuy1fllN88t6nvX8HkUEZmbWvDardwBmZlZfTgRmZk3OicDMrMk5EZiZNTknAjOzJudEYGbW5JwIzMyanBOBmVmTcyIwM2tyL6l3AHlMmDAh2tra6h2GmVlD6ezsfCwiJg62X0Mkgra2Njo6OuodhplZQ5H0SJ793DRkZtbknAjMzJqcE4GZWZNzIjAza3JOBGZmTa4hnhoyM2smC5d2MW/RSlZ19zC5tYU5M6cxa/qUws7nRGBmNoosXNrF3AXL6Vm3AYCu7h7mLlgOUFgycNOQmdkoMm/Ryo1JoFfPug3MW7SysHM6EZiZjSKrunuGtL4WnAjMzEaRya0tQ1pfC04EZmajyJyZ02gZP+4F61rGj2POz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6ois89DWxTsXwdWfMSKb69hhhHte/vYrJihvum/Qbbv9cK4DUVMb0SOIlsMpiDJL2lYt/XkjXL2RjjRGA1FVnVzG8Av5J0N3DaIB+5EGiX1EF2d3B/jtMcA8yXdDvZX71PpvVnkVUxvSt1IP+IGtz1RsTD6e2S9PVWshmhnkjLpwA/l3QL8FjFR68C3t/bWUz21E176rj9HVln8lBU+/6uI2u6uiGy6S4H27/3e7sfeJmkbVJH+dlk/RqryK7zWZJ67xhmADcMMWZrAK4+ag1H0tYR0fvkz8nApIg4oc5hNSxJJwJPR8SAYwkkTQc+HxFHlheZlcV3BNaI3pP+yr6XrCnk6/UOqMH9kBf2lfRnAvD/SojF6sB3BGZmTc53BGZmTc6JwMysyTkRmJk1OScCM7Mm50RgZtbknAjMzJrc/wBancXpjdy0kAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def reg_cost(theta,X,y,lamda):\n",
    "    \n",
    "    cost = np.sum(np.power((X@theta-y.flatten()),2))\n",
    "    reg = theta[1:]@theta[1:] * lamda\n",
    "    \n",
    "    return (cost+reg) /(2*len(X))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "303.9931922202643"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "theta = np.ones(X_train.shape[1])\n",
    "lamda =1\n",
    "reg_cost(theta,X_train,y_train,lamda)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def reg_gradient(theta,X,y,lamda):\n",
    "    \n",
    "    grad = (X@theta-y.flatten())@X\n",
    "    reg = lamda * theta\n",
    "    reg[0]=0\n",
    "    \n",
    "    return (grad+reg) / (len(X))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-15.30301567, 598.25074417])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg_gradient(theta,X_train,y_train,lamda)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "def train_model(X,y,lamda):\n",
    "    \n",
    "    theta = np.ones(X.shape[1])\n",
    "    \n",
    "    res  = minimize(fun = reg_cost,\n",
    "                   x0 = theta,\n",
    "                   args =(X,y,lamda),\n",
    "                   method = 'TNC',\n",
    "                   jac = reg_gradient)\n",
    "    \n",
    "    return res.x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "theta_final = train_model(X_train,y_train,lamda=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3XmcXFWd9/HPlxBIs0ZMEBIIiUwMOmwhERgDTMJiQFTiAuPGkgGRGaOAmEeCo6gPKE4cFBj1MSqb4rAZVpkJS8IqKAkBIksAI2ASZA9rT8jye/44t0l1d3X17U5X3aqu7/v1qlfVPffWrV/fVO6v7jnnnqOIwMzMmtcGRQdgZmbFciIwM2tyTgRmZk3OicDMrMk5EZiZNTknAjOzJudEYGbW5JwIzMyanBOBmVmT27DoAPIYMmRIjBw5sugwzMwayoIFC16IiKHd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xv5Ii1y79P0q3AZOCfgP+qtH1WbdWmlXXHu80uwIvAsA7lg7LtrZ9xG4H1tVuAIyS9E9I8s91svyVpjPVVkiaRTrZdioiXgdeURnKFNApjmznAvygNYYyk90jatDd/RAe3A58DHs+uaF4iDSR4V8nfsCx7fXTJ+14DNi9ZvpFUvUQW3+49jKPS33cpaUDDfbPtutu+zSPA35XEtANwCmkymEMk7VWy7XtI1XLWzzgRWJ+KNGrmmcBtkh4Azu7mLZcA4yXNJ10dPJrjY44FZkm6m/Sr95Ws/BekkUzvyxqQf0YfXPVGxJPZy9uz5ztJs0K9nC1/C7hC0h3ACyVvvQ74WFtjManXzfis4fZhUmNyT1T6+24kVV3dHGm6y+62b/vbHgW2lLR51lD+S1K7xnLScf6FpLYrhgnAzT2M2RqARx+1hiNps4ho6/lzKrBtRJxYcFgNS9LJwGsR0eW9BJLGAl+JiCNrF5nViq8IrBEdmv3K/hOpKuSMogNqcD+lfVtJOUOAb9QgFiuArwjMzJqcrwjMzJqcE4GZWZNzIjAza3JOBGZmTc6JwMysyTkRmJk1uf8P3DFD6NflahEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_data()\n",
    "plt.plot(X_train[:,1],X_train@theta_final,c='r')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 任务：训练样本从1开始递增进行训练，比较训练集和验证集上的损失函数的变化情况"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_learning_curve(X_train,y_train,X_val,y_val,lamda):\n",
    "    \n",
    "    x = range(1,len(X_train)+1)\n",
    "    training_cost = []\n",
    "    cv_cost = []\n",
    "    \n",
    "    for i in x:\n",
    "        \n",
    "        res = train_model(X_train[:i,:],y_train[:i,:],lamda)\n",
    "        training_cost_i = reg_cost(res,X_train[:i,:],y_train[:i,:],lamda)\n",
    "        cv_cost_i = reg_cost(res,X_val,y_val,lamda)\n",
    "        training_cost.append(training_cost_i)\n",
    "        cv_cost.append(cv_cost_i)\n",
    "    \n",
    "    plt.plot(x,training_cost,label = 'training cost')\n",
    "    plt.plot(x,cv_cost,label = 'cv cost')\n",
    "    plt.legend()\n",
    "    plt.xlabel('number of training examples')\n",
    "    plt.ylabel('error')\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEKCAYAAAAIO8L1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl8FfW9//HXJzsJaxJUZAsqWgUSICmiuKHVYvW6oBVstdJ6S9vbffEWu2l7b3u9vdZaf2p70brdWpe6VS1a9x0XQGQRWhVBIwghgQAJZP38/phJOIQTCOScTE7yfj4e8zhz5syZ8zkJzDvz/c58x9wdERGRttKiLkBERLonBYSIiMSlgBARkbgUECIiEpcCQkRE4lJAiIhIXAoIERGJSwEhIiJxKSBERCSujKgL6IzCwkIvKiqKugwRkZSycOHCje4+eG/rJS0gzOwW4Exgg7uPDZfdAxwRrjIQ2Ozu482sCFgB/CN87VV3/+rePqOoqIgFCxYkunQRkR7NzNZ0ZL1kHkHcBlwP3NGywN1ntMyb2W+A6pj133P38UmsR0RE9kHSAsLdXwiPDHZjZgZcAJycrM8XEZHOiaqT+nhgvbu/E7NslJm9aWbPm9nx7b3RzGab2QIzW1BRUZH8SkVEeqmoOqkvBO6Keb4OGOHulWZWCjxkZmPcfUvbN7r7XGAuQFlZmcYqF+mGGhoaKC8vZ8eOHVGX0qvl5OQwbNgwMjMz9+v9XR4QZ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EE05orSs/P7/1vRdffDEAJ598MpWVlVRXVzNlyhS+973vcd1117F582YyMpL7N37vPYKAoJnptT8EndXHfiPqakR6pD39pd+V8vLyWuefe+45nnrqKebPn09ubi4nnXRS3OsFsrOzW+fT09Nbm5jaWy89PZ3GxkYguFBtb9w97qmo8d5rZsyZM4czzjiDefPmMXny5KR3lPfeIwiAA46E4ZPVWS3Sw/Tr14+tW7e2+3p1dTWDBg0iNzeXlStX8uqrrya8huOOO457770XgCeeeIJNmzbtts4xxxzD888/z/vvvw/Q2sR0wgkncOeddwJBmBUWFtK/f3/ee+89xo0bxw9/+EPKyspYuXLlXr9rZ/TugICws/odWPNy1JWISIIUFBQwZcoUxo4dy2WXXbbb69OmTaOxsZHi4mJ++tOfMnny5ITXcMUVV/DEE08wceJEHnvsMYYMGUK/fv12WWfw4MHMnTuX6dOnU1JSwowZwR0RrrzyShYsWEBxcTFz5szh9ttvB+Daa69l7NixlJSU0KdPH04//XSKi4vJyMigpKQk4Z3U1pHDoO6qrKzMO33DoIbt8JsjYPRpcN7NiSlMpJdbsWIFRx55ZNRlRKquro709HQyMjKYP38+X/va11o7zbtSvN+FmS1097K9vbd390FA0FldPBMW3gqn/xpy86OuSER6gA8++IALLriA5uZmsrKyuOmmm6IuaZ8pIABKL4HX/zforD7m61FXIyI9wOjRo3nzzTejLqNT1AcBcOAYGDZJndUiIjEUEC3Kvggb/wlrXom6EhGRbkEB0eKocyB7QHAUISIiCohWWblQMgPe/ivU6lYUIiIKiFils6CpDt66O+pKRCSFXXvttdTW1kZdRqcpIGIdOAaGfVKd1SLSKQqInqp0Fmz8B3wwP+pKRKQT7rjjDoqLiykpKeHiiy+murqaoqIimpubAaitrWX48OE0NDTs8r7169dz7rnnUlJSQklJCa+8Epy4cs011zB27FjGjh3LtddeC0BNTQ1nnHEGJSUljB07lnvuuYfrrruOtWvXMnXqVKZOndq1XzrBdB1EW2Omw+M/Co4iRh4bdTUiqe+xOfDx0sRu86BxcPpV7b68fPlyfvnLX/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gqAkwiODNrW9LXwSAEzOzzsBxkZfvZNBKMb96Sh03ssHUFIMlwN3GtmFwPP7Oc2NpnZK0B/grtlAfwHwR3sloQhsZr4TS+t3H2Rmd0GvB4uutnd99a89Cwwx8wWA/8V5/UbgfvN7LPhuu0dvXTGpcBNZlZD0CdT3XYFd3/CzI4E5oeZuY2gc38a0OjufzazdOAVMzuZICweMbMFBM1CK/ejrteBvxE07f2Hu6+14E6JLW4maJJaFP6OKghu9XkScJmZNYR1fmE/Plu6mEZzFemGzKyvu28L5+cAQ9z92xHXdCWwzd2vjrIO6To6ghDpns4ws8sJ/o+uITgrSqRL6QhCRETiUie1iIjEpYAQEZG4FBAiIhKXAkJEROJSQIiISFwKCBERiev/A+N0aYHgkIROAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    " plot_learning_curve(X_train,y_train,X_val,y_val,lamda=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 任务：构造特征多项式，进行模型拟合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
